package reflectx

import (
	"gitee.com/zhongguo168a/gocodes/datax/schemax"
)

type ArrayTypeRef struct {
}

func (f *ArrayTypeRef) RefHas(field string) bool {
	switch field {
	case "Elem":
		return true
	}
	return false
}
func (f *ArrayTypeRef) RefGet(target IRefObject, ArrayType string) (val interface{}, isNil bool) {
	obj := target.(*schemax.ArrayType)
	switch ArrayType {
	case "Elem":
		return obj.Elem, obj.Elem == nil
	}
	return nil, true
}

func (f *ArrayTypeRef) RefSet(target IRefObject, ArrayType string, val interface{}) {
	obj := target.(*schemax.ArrayType)
	switch ArrayType {
	case "Elem":
		obj.Elem = val.(schemax.IType)
	}
	return
}

func (f *ArrayTypeRef) RefNew() IRefObject {
	return &schemax.ArrayType{}
}

func (f *ArrayTypeRef) RefType() string {
	return "array"
}
